import Model from "../../common/model/Model";

const {ccclass, property} = cc._decorator;

@ccclass
export default class BaseUi extends cc.Component {
    private modelEventHands : string[] = [];
    protected modelEvent(modelKey, cb) {
        cb();
        this.modelEventHands.push(Model.addListener(modelKey, cb, 1));
    }
    onDestroy() {
        this.modelEventHands.forEach(element => Model.removeListener(element));
    }
}
